package com.interview;

import java.lang.reflect.Field;

/**
 * ds..
 *
 * @author Lizhong
 * @date 2019/8/14
 */
public class IntegerChange {

    public static void main(String[] args) throws Exception {
        int i = 128; // i=10 与i=128 结果会让你吃一惊
        Integer a = Integer.parseInt(i+"");
        Integer b = Integer.valueOf(i);
        Integer c = i;
        changeValue(a, 100);
        changeValue(b, 200);
        changeValue(c, 300);
        System.out.printf("%d %d %d", a, b, c);
    }

    private static void changeValue(Integer i, int value) throws Exception {
        Field field = Integer.class.getDeclaredField("value");
        field.setAccessible(true);
        field.set(i, value);
    }
}
